package org.csu.equipment.vo;

import lombok.Data;

import java.text.NumberFormat;
import java.util.Locale;

@Data
public class Index2VO {

    int numOfOther;
    int lastNumOfOther;

    int numOfComputer;
    int numOfPrinter;
    int numOfAir;
    int numOfLight;

    int lastNumOfComputer;
    int lastNumOfPrinter;
    int lastNumOfAir;
    int lastNumOfLight;

    int GNumber;
    int SNumber;
    int MNumber;

    int[] Already = new int[10];
    int[] Other = new int[10];

    public int addThisMonth(){
        return numOfAir+numOfComputer+numOfLight+numOfPrinter;
    }

    public int addLastMonth(){
        return lastNumOfPrinter+lastNumOfAir+lastNumOfComputer+lastNumOfLight;
    }

    public String rateLastComputer(){
        double number = (numOfComputer-lastNumOfComputer)*1.0/lastNumOfComputer;
        NumberFormat format = NumberFormat.getPercentInstance(Locale.US);
        return format.format(number);
    }

    public String rateLastAir(){
        double number = (numOfAir-lastNumOfAir)*1.0/lastNumOfAir;
        NumberFormat format = NumberFormat.getPercentInstance(Locale.US);
        return format.format(number);
    }

    public String rateLastLight(){
        double number = (numOfLight-lastNumOfLight)*1.0/lastNumOfLight;
        NumberFormat format = NumberFormat.getPercentInstance(Locale.US);
        return format.format(number);
    }

    public String rateLastPrinter(){
        double number = (numOfPrinter-lastNumOfPrinter)*1.0/lastNumOfPrinter;
        NumberFormat format = NumberFormat.getPercentInstance(Locale.US);
        return format.format(number);
    }

    public String rateThisPrinter(){
        double number = numOfPrinter*1.0/addThisMonth();
        NumberFormat format = NumberFormat.getPercentInstance(Locale.US);
        return format.format(number);
    }

    public String rateThisAir(){
        double number = numOfAir*1.0/addThisMonth();
        NumberFormat format = NumberFormat.getPercentInstance(Locale.US);
        return format.format(number);
    }

    public String rateThisLight(){
        double number = numOfLight*1.0/addThisMonth();
        NumberFormat format = NumberFormat.getPercentInstance(Locale.US);
        return format.format(number);
    }

    public String rateThisComputer(){
        double number = numOfComputer*1.0/addThisMonth();
        NumberFormat format = NumberFormat.getPercentInstance(Locale.US);
        return format.format(number);
    }


}
